package cn.tx.shiro.service.impl;

import cn.tx.shiro.dao.PermissionMapper;
import cn.tx.shiro.entity.Permission;
import cn.tx.shiro.service.PermissionService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * @Description: 描述
 * @Author：XiaoBing
 * @Date：2020/11/2 17:42
 * @Version：1.0
 */
@Service
public class PermissionServiceImpl implements PermissionService {
    @Resource
    private PermissionMapper permissionMapper;

    @Override
    public List<String> findPermissionByUserId(Integer userid) {
        List<Permission> listpermission = permissionMapper.findPermissionByUserId(userid);
        // 转换类型
        List<String> permissions=new ArrayList<>();

        for (Permission permission : listpermission) {
            permissions.add(permission.getPercode());
        }
        return permissions;
    }
}
